/**
*      author: Y_Yao
*      created: 2025-02-27 20:13:28
**/

#include<bits/stdc++.h>

#define int LL
using namespace std;
using LL = long long;
const LL LLINF = 1e18;
const int INF = 0x3f3f3f3f;
const int N = 10 + 7;
char a[N][N];
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,-1,1};
int h,w,k;
int ans;
bool vis[10 + 7][10 + 7];

void dfs(int i,int j,int step)
{
    if(step == k)
    {
        ans++;
        return;
    }

    for(int K = 0;K < 4;K++)
    {
        int x = i + dx[K], y = j + dy[K];
        if(a[x][y] != '.' || vis[x][y]) continue;
        vis[x][y] = true;
        dfs(x,y,step+1);
        vis[x][y] = false;
    }
}

void solve()
{
    cin >> h >> w >> k;
    for(int i = 1;i <= h;i++)
    {
        for(int j = 1;j <= w;j++)
        {
            cin >> a[i][j];
        }
    }

    for(int i = 1;i <= h;i++)
    {
        for(int j = 1;j <= w;j++)
        {
            if(a[i][j] == '#') continue;
            vis[i][j] = true;
            dfs(i,j,0);
            vis[i][j] = false;
        }
    }
    cout << ans << endl;
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}